home *** CD-ROM | disk | FTP | other *** search
-
- SmartPrompt v1.0 Smart shell Prompt enhancement
- Documentation File
- September 26th, 1998
-
- Copyright (C) 1998 by Adrian Zurek. All rights reserved.
-
-
-
- BORING LEGAL STUFF
- ==================
-
- SmartPrompt software and this documentation are written and copyrighted
- (C) 1998 by Adrian Zurek.
-
- This program is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the Free
- Software Foundation; either version 2 of the License, or (at your option)
- any later version.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
- or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; see the file COPYING.
- If not, write to the Free Software Foundation,
- 675 Mass Ave, Cambridge, MA 02139, USA.
-
- There is no warranty, implied or whatever. You use this software at your
- own risk, no matter what purpose you put it to. You didn't pay for it, so
- don't expect magic.
-
-
- CONTACT
- =======
-
- You may contact me via snail-mail:
-
- Adrian Zurek
- ul. Mieszczanska 5/55
- 93-322 Lodz
- Poland
-
- or via e-mail:
-
- adek@plukwa.pdi.net
- or eventually
- adek@rast.lodz.pdi.net
-
- If You are familiar with IRC then You can catch me (nick aDEk) on IRCNET
- on channel #amigapl (polish language) or #amigaexotic (English).
-
- Hmmm... Maybe You should know that I'm a member of the sEASONS group. Plz
- check
- http://listen.to/floydmon
- to get more info about us :)
-
-
- HOW TO GET IT
- =============
-
- You can get it from me of course (see above) or via anonymous FTP at:
- ftp://plukwa.pdi.net/PL-A-Net/util/shell
- BTW: from here You can get another program from me:
- AScreen (archives as_xx-xx.lha)
- or hopefully from
- Aminet/util/shell (but I wouldn't be so sure about that :))
-
-
- INTRODUCTION
- ============
-
- Do You use sometimes UNIX? If the answer is yes then You probably
- noticed that *IX shells are very well organized, and their prompts can be
- very easily changed to what You want by changing only environment variable
- $PROMPT. On AmigaOS it isn't so easy: You have to change it by running
- command "Prompt" with a suitable argument. That was good some years ago,
- but now this command is too old and have too many limits.
- And here comes SmartPrompt. It is better than a real prompt and has many
- features:
-
- - Multiuser and AmiTCP support;
-
- - conditional strings placed in prompt when current user is a root or not
- a root;
-
- - *IX path styles or Amiga conventional;
-
- - two types of displaying paths;
-
- - it isn't a hack! friendly for OS!;
-
- - it's small (hmmm... could be smaller though ;) and pure so can be made
- resident!;
-
- - it's free!;
-
- - written by me! (I know that is the best feature for You ;)))
-
- There are many more features but I want to keep You in curiosity... :)
-
-
- REQUIREMENTS
- ============
-
- You need Kickstart 2.04 (V37), about 8kB free memory to run this proggy
- and some more for shell consoles and of course my AScreen (just kidding,
- but it would be very nice to use it ;))
- You will also need a hard disk or a floppy disk drive with disks, monitor
- and a keyboard (I think that there won't be any problems with this but who
- knows... :))
- And that's all! Ready to go...
-
-
- USING SmartPrompt
- =================
-
- The first thing to do is to copy SmartPrompt to c: directory or
- somewhere else where You like it , make it readable and executable for
- everyone (on Multiuser) and set a "p" protection mode which means that
- it can be made resident. Of course inserting line "Resident C:SmartPrompt"
- is a definitely a good thing to do.
- The next important step is to insert a line "Prompt *`SmartPrompt*`"
- somewhere in Your shell-startup. This tells Prompt to execute it each time
- the shell displays a new prompt.
- Hmmm... before this line You should set a environment variable called
- $PROMPT - it can be a global or a local variable. In this variable will be
- a string which tells SmartPrompt how to display Your prompt.
- So insert a line something like this: set SPROMPT "%p{ap00}"
- Hmmm... Now it's a good time to explain You all format codes that
- SmartPrompt recognizes:
-
- %u - current userid (root, nobody etc.) works only on Multiuser or
- AmiTCP! on other systems it displays 'nobody'.
- %h - hostname - Your computer name. It gets this from variable named
- $hostname.
-
- %t - current time in format hh:mm:ss for example 12:23:55.
- %d - date in format dd-mmm-yy for example 26-Sep-98.
- %w - weekday, for example Thursday.
-
- %% - displays '%' character.
- %q - displays '"' character.
- %b - displays '{' character.
- %B - displays '}' character.
-
- %R{} - this is a conditional command. The string inside "{" "}" brackets
- will be inserted in prompt string if the current user is root.
- Without Multiuser and AmiTCP it simply displays nothing.
- %r{} - same as above but displays string if the current user isn't a root.
- Without Multiuser and AmiTCP it displays specified string.
- NOTE: in brackets can be all format codes except %R{} and %r{} to avoid
- recursion!
-
- %p{} - this tells SmartPrompt to display current path. In "{" "}" brackets
- are additional format codes:
- a - display current path in Amiga style e.g. "Work:tmp" - default.
- x - display current path in *IX style e.g. "/Work/tmp".
- d - replace volume names as "Work:" or "Ram Disk:" with device names
- "DH0:", "RAM:". Note that if this isn't specified SmartPrompt will
- still replace volume names that has a <SPACE> character inside it
- with device name, so "Ram Disk:" will be always replaced by "RAM:".
- pxx - format code "p" tells SmartPrompt how to display current path. The
- number after a "p" character is very important and HAS to be in two
- digits e.g. "02". Only xx last components of path will be displayed
- so if the path is "Work:my/gfx/tmp" and the number is "02" You will
- see only "gfx/tmp" string. If the number is greater than the total
- number of components in the path it will show everything.
- "00" means: always show everything.
- Pxx - second path style. The difference between above style and this is
- that now the "xx" number specifies max prompt length. If the
- original prompt length is greater than that You gave, it will be
- shortened to its abbreviation. Like above, number has to be in two
- digits.
- Example: a path like "Work:my/gfx/tmp/outcoming" will be shortened
- to "Work:///outcoming" if it exceeds the desired prompt length.
- As You can see here is a name of volume, one slash for each subdir
- and a full name of the last component. Please note that the last
- path component will be always displayed even if the resulting
- string is longer than Your limit.
-
- And that's all folks (really simple isn't it? :))
- No, it isn't simple so I think now it's a good time for
-
- EXAMPLES
- ========
-
- Lets say You want to have a *IX style prompt like this:
- "[adek@rast:0 archives]$ "
- it's very simple with SmartPrompt to do this! see:
- set SPROMPT "[%u@%h:$ascreen %p{xp01}]%R[#]%r{$} "
- hehe... can You still understand this? Note that "$ascreen" is the local
- variable from AScreen which consists actual window number. As You can see
- You may insert environment variables into its string. And here is a good
- time to tell You that now the main limit for this program that it cannot
- get an actual process number. Why? Because SmartPrompt is executed in
- a new process, so its number is different than the shell number. But it is
- still to be displayed: just insert "$process" string somewhere in Your
- $SPROMPT variable.
-
- Second example: You can make a prompt colored! Just look at this line:
- set SPROMPT "[%R{*E[32m}%u%R{*E[0m}@%h:$ascreen %p{xp01}]%R[#]%r{$} "
- it's very similar to the previous example but displays userid in red
- color (on my system it is red ;)). Of course "*E[32m" and "*E[0m" are the
- standard console codes.
-
- Ufff... Maybe it isn't enough for You to know everything but try it! Just
- insert various combinations of the format codes and see the results!
-
- NOTE: if You have Multiuser or/and AmiTCP installed, but its corresponding
- libraries (multiuser.library/usergroup.library) aren't started, than
- SmartPrompt won't know that they are installed!
- But this shouldn't be a problem for You because usually before
- a shell prompt displays You login to the system.
-
-
- TODO
- ====
-
- Not many as this should be a very small, quick and handy program:
-
- - make him able to get a current process number;
-
- - support for recognizing and displaying homedirs and assigns;
-
-
- EPILOG
- ======
-
- And at the end I'd like to thanks all the people who want to be with
- Amiga, for good and for the worst (It seems that now are the worst :().
- And finally here are special, individual greetings:
-
- Robert "rEkiN" Redziak - encouraged me to do this and showed me similar
- programs.
- Matthias Bethke - for his PromptPath from which I got an idea for
- the second style path.
- all sEASONS members - for being great m8s and for much fun!
-